package com.java.demo7;

public class Test {
    /**
     * 编译阶段
     * 成员属性   编译看左边，执行看左边
     * 成员方法   编译看左边，执行看右边
     * */
    public static void main(String[] args) {
        //本身的类型引用new本身对象
        Dog dog = new Dog();
        dog.eat();
        //父类引用指向子类,多态
        Animal animal = new Dog();

        //编译阶段报错
        //animal.weight;

        Dog dog2 = new Dog();
        dog2.eat();
        System.out.println(dog2.age);
        System.out.println(dog2.weight);
    }
}
